package com.zq.solution.string;

/**
 * @ClassName MatchSubString
 * @Description 匹配字符串字串
 * @Author ZQ
 * @Date 2020/10/30 10:44
 * @Version V1.0
 **/
public class MatchSubString {
    public static int matchSubString(String s,String t){
        if (s == null || t == null) return -1;

        for (int i = 0; i < s.length() - t.length() + 1; i++){
            String tmp = s.substring(i, i + t.length());
            if (t.equals(tmp)) return i;
        }
        return -1;
    }

    public static void main(String[] args) {
        System.out.println(matchSubString("aergnullaergear","null"));
    }
}
